<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
    <div id="app">
        <span>{{msg}}</span>
    </div>
</body>
<script src="./js/vue.js"></script>
<script>
    Vue.config.productionTip = false;
    var vm = new Vue({
        el:"#app", //1.el帮我们指定了模板 2.确定了vm对应的挂载节点
        data:{
            msg:"msg"
        }
    })

    function five(val){
        console.log(5,val)
    }
    vm.$on("damu",(val)=>{console.log(1,val)})
    vm.$on("damu",(val)=>{console.log(2,val)})
    vm.$on("damu",(val)=>{console.log(3,val)})
    vm.$on("damu",(val)=>{console.log(4,val)})
    vm.$on("damu",five)
    vm.$on("damu",(val)=>{console.log(6,val)})
    vm.$on("damu",(val)=>{console.log(7,val)})
    setInterval(()=>{
        vm.$emit("damu","damu")
    },1000)
    setTimeout(()=>{
        vm.$off("damu",five)
    },3000)

</script>
</html>